import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleDateTest1 {
    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat();
        Date date = new Date();
        String format = sdf.format(date);
        System.out.println(format);

        try {
            Date date2 = sdf.parse("2025/3/2 下午3:56");
            System.out.println(date2);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void test() {
        SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        String format = s1.format(date);
        System.out.println(format);

        try {
            Date date2 = s1.parse("2025-01-01 00:01:00");
            System.out.println(date2);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
